<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="教师名称" prop="teacherName">
        <el-input
          v-model="queryParams.teacherName"
          placeholder="请输入教师名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证号" prop="idCard">
        <el-input
          v-model="queryParams.idCard"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="教师号" prop="teacherNum">
        <el-input
          v-model="queryParams.teacherNum"
          placeholder="请输入教师号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="民族" prop="teacherFolk">-->
<!--        <el-input-->
<!--          v-model="queryParams.teacherFolk"-->
<!--          placeholder="请输入民族"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="生日" prop="birthDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.birthDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择生日">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="籍贯" prop="nativePlace">-->
<!--        <el-input-->
<!--          v-model="queryParams.nativePlace"-->
<!--          placeholder="请输入籍贯"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="年龄" prop="teacherAge">-->
<!--        <el-input-->
<!--          v-model="queryParams.teacherAge"-->
<!--          placeholder="请输入年龄"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="手机号码" prop="phoneNum">
        <el-input
          v-model="queryParams.phoneNum"
          placeholder="请输入手机号码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="宿舍" prop="dormitory">-->
<!--        <el-input-->
<!--          v-model="queryParams.dormitory"-->
<!--          placeholder="请输入宿舍"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="现居住地址" prop="currentAddress">-->
<!--        <el-input-->
<!--          v-model="queryParams.currentAddress"-->
<!--          placeholder="请输入现居住地址"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="所在班级" prop="className">-->
<!--        <el-input-->
<!--          v-model="queryParams.className"-->
<!--          placeholder="请输入所在班级"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="所在学院" prop="collegeName">-->
<!--        <el-input-->
<!--          v-model="queryParams.collegeName"-->
<!--          placeholder="请输入所在学院"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="当日体温情况" prop="temperature">-->
<!--        <el-input-->
<!--          v-model="queryParams.temperature"-->
<!--          placeholder="请输入当日体温情况"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['people:teacher:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['people:teacher:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['people:teacher:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['people:teacher:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
        >导入
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="teacherList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column v-if="columns[0].visible" label="教师编号" align="center" prop="teacherId" />
      <el-table-column v-if="columns[1].visible" label="教师名称" align="center" prop="teacherName" />
      <el-table-column v-if="columns[2].visible" label="身份证号" align="center" prop="idCard" />
      <el-table-column v-if="columns[3].visible" label="邮箱" align="center" prop="email" />
      <el-table-column v-if="columns[4].visible" label="性别" align="center" prop="sex">
        <template slot-scope="scope">
          <span v-if="scope.row.sex === '0'">男</span>
          <span v-if="scope.row.sex === '1'">女</span>
        </template>
      </el-table-column>
      <el-table-column v-if="columns[5].visible" label="教师号" align="center" prop="teacherNum" />
      <el-table-column v-if="columns[6].visible" label="民族" align="center" prop="teacherFolk" />
      <el-table-column v-if="columns[7].visible" label="生日" align="center" prop="birthDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.birthDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="columns[8].visible" label="籍贯" align="center" prop="nativePlace" />
      <el-table-column v-if="columns[9].visible" label="年龄" align="center" prop="teacherAge" />
      <el-table-column v-if="columns[10].visible" label="职务类别" align="center" prop="jobType">
        <template slot-scope="scope">
          <span v-if="scope.row.jobType === '0'">普通教师</span>
          <span v-if="scope.row.jobType === '1'">班主任</span>
        </template>
      </el-table-column>
      <el-table-column v-if="columns[11].visible" label="手机号码" align="center" prop="phoneNum" />
      <el-table-column v-if="columns[12].visible" label="宿舍" align="center" prop="dormitory" />
      <el-table-column v-if="columns[13].visible" label="现居住地址" align="center" prop="currentAddress" />
      <el-table-column v-if="columns[14].visible" label="所在班级" align="center" prop="className" />
      <el-table-column v-if="columns[15].visible" label="所在学院" align="center" prop="collegeName" />
      <el-table-column v-if="columns[16].visible" label="当日杭州健康码颜色" align="center" prop="healthColor">
        <template slot-scope="scope">
          <span style="color: #0af70e" v-if="scope.row.healthColor === '0'">绿</span>
          <span style="color: #e3f70a" v-if="scope.row.healthColor === '1'">黄</span>
          <span style="color: red;font-weight: bolder" v-if="scope.row.healthColor === '2'">红</span>
        </template>
      </el-table-column>
      <el-table-column v-if="columns[17].visible" label="当日体温情况(℃)" align="center" prop="temperature" />
      <el-table-column v-if="columns[18].visible" label="健康情况" align="center" prop="isHeathy">
        <template slot-scope="scope">
          <span v-if="scope.row.isHeathy === '0'">健康</span>
          <span style="font-weight: bolder;color: red" v-if="scope.row.isHeathy === '1'">异常</span>
        </template>
      </el-table-column>
      <el-table-column v-if="columns[19].visible" label="是否为危险人群" align="center" prop="isDanger">
        <template slot-scope="scope">
          <span v-if="scope.row.isDanger === '0'">正常</span>
          <span style="color: red;font-weight: bolder" v-if="scope.row.isDanger === '1'">异常</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['people:teacher:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['people:teacher:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改教师信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="110px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="教师名称" prop="teacherName">
              <el-input v-model="form.teacherName" placeholder="请输入教师名称" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="身份证号" prop="idCard">
              <el-input v-model="form.idCard" placeholder="请输入身份证号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="教师号" prop="teacherNum" required>
              <el-input v-model="form.teacherNum" placeholder="请输入教师号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="民族" prop="teacherFolk">
              <el-input v-model="form.teacherFolk" placeholder="请输入民族" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="邮箱" prop="email">
              <el-input v-model="form.email" placeholder="请输入邮箱" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="生日" prop="birthDate">
              <el-date-picker clearable
                              v-model="form.birthDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择生日">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="籍贯" prop="nativePlace">
              <el-input v-model="form.nativePlace" placeholder="请输入籍贯" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="年龄" prop="teacherAge">
              <el-input v-model="form.teacherAge" placeholder="请输入年龄" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="手机号码" prop="phoneNum">
              <el-input v-model="form.phoneNum" placeholder="请输入手机号码" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="宿舍" prop="dormitory">
              <el-input v-model="form.dormitory" placeholder="请输入宿舍" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="现居住地址" prop="currentAddress">
              <el-input v-model="form.currentAddress" placeholder="请输入现居住地址" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日体温情况" prop="temperature">
              <el-input v-model="form.temperature" placeholder="请输入当日体温情况" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所在班级" prop="className">
              <el-input v-model="form.className" placeholder="请输入所在班级" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="所在学院" prop="collegeName">
              <el-input v-model="form.collegeName" placeholder="请输入所在学院" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="性别" prop="sex">
              <el-select v-model="form.sex" placeholder="请选择性别">
                <el-option  v-for="(item) in sexType" :key="item.type" :label="item.name" :value="item.type"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当日健康码颜色" prop="healthColor">
              <el-select v-model="form.healthColor" placeholder="请选择健康码颜色">
                <el-option v-for="(item) in healthColorType" :key="item.type" :label="item.name" :value="item.type"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="是否危险人群" prop="isDanger">
              <el-select v-model="form.isDanger" placeholder="是否危险人群">
                <el-option  v-for="(item) in isDangerType" :key="item.type" :label="item.name" :value="item.type"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="健康状况" prop="isHeath">
              <el-select v-model="form.isHeathy" placeholder="健康状况">
                <el-option  v-for="(item) in isHealthType" :key="item.type" :label="item.name" :value="item.type"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="职务类别" prop="jobType">
              <el-select v-model="form.jobType" placeholder="职务类别">
                <el-option  v-for="(item) in empJobType" :key="item.type" :label="item.name" :value="item.type"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px; vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listTeacher, getTeacher, delTeacher, addTeacher, updateTeacher } from "@/api/people/teacher";
import {getToken} from "@/utils/auth";

const sexType=[
  {type:"0",name:"男"},
  {type:"1",name:"女"},
]
const healthColorType=[
  {type:'0',name:'绿'},
  {type:'1',name:'黄'},
  {type:'2',name:'红'},
]

const isDangerType=[
  {type: '0',name:'正常'},
  {type: '1',name:'危险'},
]

const isHealthType=[
  {type:'0',name:'健康'},
  {type:'1',name:'异常'},
]
const empJobType=[
  {type:'1',name:'班主任'},
  {type:'0',name:'普通教师'},
]
export default {
  name: "Teacher",
  data() {
    return {
      // 遮罩层
      loading: true,
      sexType,
      healthColorType,
      isDangerType,
      isHealthType,
      empJobType,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 教师信息表格数据
      teacherList: [],
      //列筛选
      columns:[
        {key:0,label:'教师编号',visible:false},
        {key:1,label:'教师名称',visible:true},
        {key:2,label:'身份证号',visible:false},
        {key:3,label:'邮箱',visible:false},
        {key:4,label:'性别',visible:true},
        {key:5,label:'教师号',visible:true},
        {key:6,label:'民族',visible:false},
        {key:7,label:'生日',visible:false},
        {key:8,label:'籍贯',visible:false},
        {key:9,label:'年龄',visible:true},
        {key:10,label:'职务类别',visible:false},
        {key:11,label:'手机号码',visible:true},
        {key:12,label:'宿舍',visible:true},
        {key:13,label:'现居住地址',visible:false},
        {key:14,label:'所在班级',visible:false},
        {key:15,label:'所在学院',visible:true},
        {key:16,label:'当日健康码颜色',visible:true},
        {key:17,label:'当日体温情况(℃)',visible:true},
        {key:18,label:'健康情况',visible:true},
        {key:19,label:'是否为危险人群',visible:true},
      ],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/people/teacher/importData"
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        teacherName: null,
        idCard: null,
        sex: null,
        teacherNum: null,
        teacherFolk: null,
        birthDate: null,
        nativePlace: null,
        teacherAge: null,
        jobType: null,
        phoneNum: null,
        email:null,
        dormitory: null,
        currentAddress: null,
        className: null,
        collegeName: null,
        healthColor: null,
        temperature: null,
        isHeathy: null,
        isDanger: null
      },
      // 表单参数
      form:{},
      // 表单校验
      rules: {
          teacherName: [
            { required: true, message: "教师名称不能为空", trigger: "blur" },
            { min: 2, max: 20, message: '教师名称长度必须介于 2 和 20 之间', trigger: 'blur' }
          ],
          idCard: [
            { pattern: /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
              message: "请输入正确的身份证号码",
              trigger: "blur",
              required: true
            }
          ],
          email: [
            {
              type: "email",
              message: "请输入正确的邮箱地址",
              trigger: ["blur", "change"]
            }
          ],
        teacherNum: [{
          message: "请输入教师号",
          trigger: "blur",
          required:true
        }
        ],
          phoneNum: [
            {
              pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
              message: "请输入正确的手机号码",
              trigger: "blur"
            }
          ]
      },
      filters:{
        sexTypeFilter(type){
          const sexTy=sexType.find(obj=>obj.type===type);
          return sexTy ? sexTy.name :null;
        },

        isDangerTypeFilter(type){
          const isDangerTy=isDangerType.find(obj=>obj.type===type);
          return isDangerTy ? isDangerTy.name:null;
        },
        isHealthTypeFilter(type){
          const isHealthTy=isHealthType.find(obj=>obj.type===type);
          return isHealthTy ? isHealthTy.name:null;
        },
        healthColorTypeFilter(type){
          const healthColorTy=healthColorType.find(obj=>obj.type===type);
          return healthColorTy ? healthColorTy.name:null;
        },
        empJobTypeFilter(type){
          const empJobTy=empJobType.find(obj=>obj.type===type);
          return empJobTy ? empJobTy.name:null;
        },

      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询教师信息列表 */
    getList() {
      this.loading = true;
      listTeacher(this.queryParams).then(response => {
        this.teacherList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        teacherId: null,
        teacherName: null,
        idCard: null,
        sex: "0",
        teacherNum: null,
        teacherFolk: null,
        birthDate: null,
        nativePlace: null,
        teacherAge: null,
        jobType: null,
        phoneNum: null,
        dormitory: null,
        currentAddress: null,
        className: null,
        collegeName: null,
        healthColor: null,
        temperature: null,
        isHeathy: null,
        isDanger: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.teacherId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加教师信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const teacherId = row.teacherId || this.ids
      getTeacher(teacherId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改教师信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.teacherId != null) {
            updateTeacher(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addTeacher(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const teacherIds = row.teacherId || this.ids;
      this.$modal.confirm('是否确认删除教师信息编号为"' + teacherIds + '"的数据项？').then(function() {
        return delTeacher(teacherIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('people/teacher/export', {
        ...this.queryParams
      }, `teacher_${new Date().getTime()}.xlsx`)
    },

    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "教师导入";
      this.upload.open = true;
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('people/teacher/importTemplate', {
      }, `教师信息表_模板_${new Date().getTime()}.xlsx`)
    },

    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
// 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
// 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
  },
};
</script>
